package cn.pinming.entity.system;

import cn.pinming.entity.BaseEntity;
import cn.pinming.entity.SexEnum;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.Set;

/**
 * 系统用户表(SysUser)实体类
 *
 * @author makejava
 * @since 2020-02-02 21:52:50
 */
@Data
@Entity
@Table(name = "`sys_user`")
public class SysUser extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 727356307228991156L;
    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 用户姓名
     */
    private String username;
    /**
     * 用户密码
     */
    private String password;
    /**
     * 用户昵称
     */
    private String nickname;
    /**
     * 性别：0男、1女
     */
    @Enumerated
    private SexEnum sex;
    /**
     * 生日
     */
    private LocalDate birthday;
    /**
     * 手机
     */
    private Integer phone;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "sys_role_user", joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")},
            inverseJoinColumns = {@JoinColumn(name = "role_id", referencedColumnName = "id")})
    private Set<SysRole> sysRoleSet;

}